package Cy.Servlet;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import Cy.DAO.CommodityDAO;
import extend.DCextendsCommodity;
import Factory.CommodityFactory;

/**
 * Servlet implementation class SelectShangjiaServlet
 */
@WebServlet("/selectshangjia")
public class SelectShangjiaServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;
	private CommodityDAO commodityDAO = CommodityFactory.createDAO();
	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		response.setContentType("text/html;charset=utf-8");
		List<DCextendsCommodity> list = commodityDAO.selectcommodityshangjia();
		try{
			int cid = Integer.parseInt(request.getParameter("cid"));
			request.setAttribute("cid", cid);
		}catch(Exception e){
			
		}
		request.setAttribute("list", list);
		request.getRequestDispatcher("CommodityShangjia.jsp").forward(request, response);
	}

}
